<?php

namespace App\Admin\Controllers;

use App\Extensions\Content;
use App\Extensions\EGrid;
use App\Http\Controllers\Controller;
use App\PatentApply;
use Encore\Admin\Form;
use Encore\Admin\Show;

class PatentMonitorController extends Controller
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '';

    public function priority(Content $content)
    {
        return $content
            ->title('优审监控')
            ->description(trans('admin.list'))
            ->body($this->priorityGrid());
    }

    protected function priorityGrid(): EGrid
    {
        $grid = new EGrid(new PatentApply());
        $grid->model()
            ->where('review_status',1)
            ->whereNotNull('patent_sn')
            ->where('patent_type_id',1)
            ->where('status',1)
            ->where('agency_id',6)
        ;
        $grid->column('patent_sn', __('Patent sn'));
        $grid->column('patent_name', __('Patent name'));
        $grid->column('apply_date', __('Apply date'));
        $grid->column('patent_type_id', __('专利类型'))->using(patent_type_select_option())->width(80);
        $grid->column('department.name', __('dept_name'));
        $grid->column('agency.company', __('代理机构'));
        $grid->disableCreateButton();
        $grid->disableActions();
        return $grid;
    }

}
